<?php
if($this->ma == 2){
    echo '<script language="javascript" type="text/javascript">alert("完成和取消的运单不能出现问题！");</script>';
}else if($this->ma == 1){
    echo '<script language="javascript" type="text/javascript">alert("问题运单标记成功！");location.href="/admini/managewaybill/billaccep/id/'.$this->billall->id.'";</script>';
}else if($this->ma == 3){
    echo '<script language="javascript" type="text/javascript">alert("设置成功！");location.href="/admini/managewaybill/billaccep/id/'.$this->billall->id.'";</script>';
}else if($this->ma == 4){
    echo '<script language="javascript" type="text/javascript">alert("请检查运单的前后台状态！");location.href="/admini/managewaybill/billaccep/id/'.$this->billall->id.'";</script>';
}else if($this->ma == 5){
    echo '<script language="javascript" type="text/javascript">alert("留言内容不能为空！");location.href="/admini/managewaybill/billaccep/id/'.$this->billall->id.'";</script>';
}
$pd = true;
$premiumFee = $this->billall->getFeeByType(Application_Model_FeeType::RatePremiumFee);
?>
<div class="admin_nrtop">
    <div class="yundantopleft">
        <div class="yundancz">
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/index/" class="nui-btn-text"><span>&lt;&lt;</span>返回</a>
                </div>
            </div>                    
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id='issue' class="nui-btn-text">问题包裹</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/invoice/id/<?php echo $this->billall->id ?>" class="nui-btn-text">编辑发票</a>
                </div>
                <div class="nui-btn" id="editupdete">
                    <a href="javascript:void(0)" class="nui-btn-text rxl" id="editInterior">修改后台状态<i></i></a>
                    <div class="ztlist" style="display:none;">
                        <ul>
                            <?php foreach ($this->billall->EditInteriorAll as $key => $eccomp) { ?>
                                <li><a href="javascript:editInterior(<?php echo $key; ?>,'<?php echo $eccomp; ?>')"><?php echo $eccomp; ?></a></li>
                            <?php }?>
                        </ul>
                    </div>
                </div>
                <div class="nui-btn " id="updeteedit">
                    <a href="javascript:void(0)" class="nui-btn-text rxl" id="editStatus">修改前台状态<i></i></a>
                    <div class="ztlist" style="display:none;">
                        <ul>
                            <?php foreach ($this->billall->EditStatusAll as $key => $eccomp) { ?>
                                <li><a href="javascript:editStatus(<?php echo $key; ?>,'<?php echo $eccomp; ?>')"><?php echo $eccomp; ?></a></li>
                            <?php }?>
                        </ul>
                    </div>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id='remarkUuch' class="nui-btn-text">内部备注</a>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id="cancel" class="nui-btn-text">取消</a>
                </div>
            </div>     
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/print/id/<?php echo $this->billall->id; ?>" class="nui-btn-text">打印清单</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/addform/id/<?php echo $this->billall->id; ?>" class="nui-btn-text">地址标签</a>
                </div>
                <div class="nui-btn ">
                    <a href="<?php echo $this->invoicedetail ? "/admini/managewaybill/invoice/ma/5/id/" . $this->billall->id : "/admini/managewaybill/invoice/id/" . $this->billall->id; ?>" class="nui-btn-text">打印发票</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/addbill/id/<?php echo $this->billall->id; ?>" class="nui-btn-text">快递单</a>
                </div>
            </div>     
        </div>
        <div class="yundangrinfo">
            <p>悠奇运单编号：<?php echo $this->billall->billNo; ?><span>|</span>
                用户：<a href="/admini/manageuser/userdetail/id/<?php echo $this->billall->userId; ?>" target="_blank"><?php echo $this->billall->user->nikename; ?></a><span>|</span>
                仓库号：<a href="/admini/managestore/index/nostore/<?php echo $this->billall->user->storeno; ?>" target="_blank"><?php echo $this->billall->user->storeno; ?></a><span>|</span>
                提交时间：<?php echo $this->billall->dateCreated; ?><span>|</span>付款时间：<?php echo $this->billall->datePaid; ?></p>
        </div>
    </div>
    <div class="yundantopright">
        <p>用户ID：<?php echo $this->billall->userId; ?></p>
    </div>
    <div class="buzhou" style="clear:both">
        <div class="bzbox">
            <table>
                <tr>
                    <?php
                    $interiorall = $this->billall->InteriorCorrect;
                    foreach ($interiorall as $key => $interiorval) {
                        $billLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, $key);
                        ?>
                        <td <?php echo $billLog ? 'class="bz_wanl"' : ""; ?>>
                            <div class="bzloading">
                                <div class="dian"><?php echo ($billLog ? '<a href="javascript:void(0)"><i></i><span>'.$interiorval[1] : '<i></i><span>'.$interiorval[0]).'</span></a>'; ?></div>
                                <?php if ($billLog) { ?>
                                    <div class="bzxiangbox" style="display: none;">
                                        <div class="xjiantou"></div>
                                        <div class="xianginfo">
                                            <ul>
                                                <li><label>处理时间：</label><em><?php echo $billLog->dateCreated; ?></em></li>
                                                <li><label>责任人：</label><em><?php echo $billLog->operator; ?></em></li>
                                            </ul>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </td>
                    <?php } ?>
                    <td <?php echo $this->billall->interior == Application_Model_wayBillItem::Interior_Achieve ? 'class="bz_wanr"' : ""; ?>></td>
                </tr>
            </table>
        </div>
        <div class="bzxiang"></div>
    </div>
</div>    
<div class="yundan_top">
    <table class="yunxinxi">
        <tr>
            <td class="ydleft">
                <div class="zhuangtai">
                    <i></i><h1><?php echo $this->billall->problem == Application_Model_wayBillItem::Problem_Cancel?"取消":$this->billall->interiorname;?>
                        <?php if($this->billall->problem == Application_Model_wayBillItem::Problem_Appear){?><em>(问题)</em><?php }?></h1><span>[前台状态：<?php echo $this->billall->statusname; ?>]</span>
                </div>
                <div class="shouli">
                    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Processing){ ?>
                        <a class="anvbotton5" href="javascript:void(0)" id="hear"><span>受理</span></a>
                    <?php }?>
                </div>
            </td>
            <td class="ydtopline">
                <div class="zhtailan">
                    <label>状态栏：</label>
                    <div class="ydtishi">
                        <?php if($premiumFee > 0) { ?><a class="ts0" href="javascript:void(0)" title="已投保">已投保</a><?php }?>
                        <?php if($this->billall->isInvoice == 1){?><a class="ts1" href="/admini/managewaybill/preview/id/<?php echo $this->billall->id;?>" title="已制发票" target="_blank">已制发票</a><?php }?>
                        <?php if($this->billall->isAddform == 1){?><a class="ts2" href="/admini/managewaybill/addform/id/<?php echo $this->billall->id;?>" title="已打印地址" target="_blank">已打印地址</a><?php }?>
                        <?php if($this->billall->problem == Application_Model_wayBillItem::Problem_Appear){?><a class="ts3" href="javascript:void(0)" id='issue' title="问题包裹">问题包裹</a><?php }?>
                        <?php if($this->billall->problem == Application_Model_wayBillItem::Problem_Aolve || $this->billall->problem == Application_Model_wayBillItem::Problem_Cancel){?><a class="ts3_" href="javascript:void(0)" id='issue' title="问题包裹">问题包裹</a><?php }?>
                        <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_PickError && $this->billall->interior!= Application_Model_wayBillItem::Interior_Achieve){?>
                        <a class="ts4" href="javascript:void(0)" title="预警提示">预警提示</a><?php }?>
                        <!--<a class="ts5" href="javascript:void(0)" title="有私信">有私信</a>-->
                        <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_PickError){ ?><a class="ts6" href="/admini/managewaybill/picking/id/<?php echo $this->billall->id;?>" title="拣货异常" target="_blank">拣货异常</a><?php } ?>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td class="ydleft">
                <table>
                    <tr>
                        <td class="xleft">运送方式：</td>
                        <td class="xlright"><?php echo $this->billall->ExpressBy->name;?></td>
                        <td class="xleft">物品净重：</td>
                        <td class="xlright"><?php echo ($this->billall->productWeight / 1000); ?>kg</td>
                    </tr>
                    <tr>
                        <td class="xleft">预付款：</td>
                        <td class="xlright">
                            <em class="jiner">￥<?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateSum);?></em>
                            <div class="jinerxial">
                                <a class="jinerjt" href="javascript:void(0)"><span></span></a>
                                <div class="jinerxiang" style="display:none;">
                                    <ul>
                                        <li><label>国际运费：</label><span id="shipMoney"><?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee);?>元</span></li>
                                        <?php if ($this->billall->isCompress == 1) { ?><li><label>真空服务：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::VacuumSeviceFee);?>元</span></li><?php }?>
                                        <?php if ($this->billall->isWooden == 1) { ?><li><label>木架服务：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::WoodenFee);?>元</span></li><?php }?>
                                        <?php if ($premiumFee > 0) {
                                                echo "<li><label>保险费：</label><span>".$premiumFee."元</span></li>";
                                            } ?>
                                        <?php if ($this->billall->discountFee > 0) { ?><li><label>优惠券：</label><span>-<?php echo $this->billall->discountFee; ?>元</span></li><?php } ?>
                                    </ul>
                                </div>
                            </div></td>
                        <td class="xleft">预付重量：</td>
                        <td class="xlright"><?php
                                if ($this->billall->ExpressBy->isVolume == 1) {
                                    if ($this->billall->volumeWeight > ($this->billall->productWeight + $this->billall->bagWeight)) {
                                        $byweight = 2;
                                        $payWeight = ($this->billall->volumeWeight / 1000);
                                        echo ($this->billall->volumeWeight / 1000)."kg(体积)" ;
                                    } else {
                                        $byweight = 1;
                                        $payWeight = (($this->billall->productWeight + $this->billall->bagWeight) / 1000);
                                        echo (($this->billall->productWeight + $this->billall->bagWeight) / 1000)."kg(重量)" ;;
                                    }
                                } else {
                                    $byweight = 1;
                                    $payWeight = (($this->billall->productWeight + $this->billall->bagWeight) / 1000);
                                    echo (($this->billall->productWeight + $this->billall->bagWeight) / 1000)."kg(重量)" ;;
                                }
                           ?></td>
                    </tr>
                    <tr>
                        <td class="xleft">EORI/税号：</td>
                        <td class="xlright"><?php echo $this->billall->dutyNo==""?"无":$this->billall->dutyNo; ?></td>
                        <td class="xleft">申报价值：</td>
                        <td class="xlright"><?= $this->billall->getFeeByType(Application_Model_FeeType::ReprotValue) > 0 ? '$' . $this->billall->getFeeByType(Application_Model_FeeType::ReprotValue): '未填写' ?></td>
                    </tr>
                    <tr>
                        <td class="xleft">特殊操作：</td>
                        <td class="xlright">
                            <ul class="tscz">
                                <?php if ($this->billall->isCompress == 0 && $this->billall->isNoLogo == 0 && $this->billall->isNoSkin == 0 && $this->billall->isWooden == 0) { ?>
                                    无
                                <?php } if ($this->billall->isNoLogo == 1) { ?>
                                    <li><i>去吊牌</i></li>
                                <?php } if ($this->billall->isNoSkin == 1) { ?>
                                    <li><i>去包装</i></li>
                                <?php } if ($this->billall->isWooden == 1) { ?>
                                    <li><i>打木架</i></li>
                                <?php } if ($this->billall->isCompress == 1) { ?>
                                    <li><i>真空</i></li>
                                <?php } ?>
                            </ul>
                        </td>
                        <td class="xleft">是否投保：</td>
                        <td class="xlright"><?php if ($premiumFee > 0) {
                            echo '(投保价值:<span id="premiumFee">' . $this->billall->getFeeByType(Application_Model_FeeType::PremiumValue) . '</span>元)';
                        } else {
                            echo '未投保';
                        }
                        ?></td>
                    </tr>
                </table>
            </td>
            <td class="ydtopline sdq" rowspan="2">
                <table class="yddizhi">
                    <tr>
                        <td class="dzl">收件姓名：</td>
                        <td><?php echo htmlspecialchars($this->billall->consignee); ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">目的国家：</td>
                        <td><?php echo $this->billall->UserCity->name . '(' . $this->billall->UserCity->ename . ')'; ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">邮政编码：</td>
                        <td><?php echo htmlspecialchars($this->billall->conPostCode); ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">详细地址：</td>
                        <td><?php echo htmlspecialchars($this->billall->conAdd); ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">联系电话：</td>
                        <td><?php echo htmlspecialchars($this->billall->conTel); ?></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="ydleft">
                <table>
                    <tr>
                        <td class="xleft">备注：</td>
                        <td><?php echo htmlspecialchars($this->billall->remark); ?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<div class="ydbottom">
    <?php if($this->billall->interiorRemark){ ?>
        <div class="youqiliuyan">
            <div class="lanmu">
                <h2>悠奇内部留言</h2>
            </div>
            <div class="yqly">
                <?php $arrInteriorRemark = explode("留言：",$this->billall->interiorRemark);?>
                <?php echo "<p><b>$arrInteriorRemark[0]留言：</b>$arrInteriorRemark[1]</p>"?>
            </div>
        </div>
    <?php }?>
<?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Confrimed){ ?>
    <div class="chuku">
        <div class="lanmu">
            <h2>出库流程</h2>
        </div>
        <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Confrimed && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){ ?>
        <div class="lcbox">
            <table class="lcks" >
                <tr>
                    <td class="lcleft"><p>待选择渠道</p></td>
                    <td>
                        <form method="post" action="/admini/managewaybill/affirmshipchannel/id/<?php echo $this->billall->id; ?>" id="formshipchanner">
                        <div class="qudao">
                            <dl>
                                <dt>代理商选择：</dt>
                                <dd>
                                    <?php foreach ($this->agentcomp as $key => $agentcomp) { ?>
                                        <label><input type="radio" name="agentid" class="agentid" value="<?php echo $agentcomp->id; ?>"/><?php echo $agentcomp->name; ?></label>
                                    <?php } ?>
                                </dd>
                            </dl>
                            <dl>
                                <dt>发货渠道：</dt>
                                <dd>
                                    <select name="channer" id="channer">
                                    </select><label class="suoyou"><input name="radioChannel" id="radioChannel" type="checkbox" value="">所有</label>
                                </dd>
                            </dl>
                            <div class="lctijiao">
                                <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                <input type="hidden" id="operate" name="operate" value="examine" />
                                <a class="anvbotton5" href="javascript:$('#formshipchanner').submit();" id="shipchanner"><span>确认</span></a>
                            </div>
                        </div>
                        
                        <div class="qudaojiage">
                            <div class="jglan">
                                <h3><?php echo ($payWeight)."kg - ".$this->billall->ExpressBy->name;?>各渠道价格对比</h3>
                                <div class="qitaqd">
                                    <label>其他方式：</label>
                                    <select name="editshiptype" id="editshiptype">
                                        <?php foreach ($this->allshiptype as $eccomp) { ?>
                                            <option value="<?php echo $eccomp->id; ?>" <?php echo $eccomp->id == $this->billall->expressId?"selected":""; ?>><?php echo $eccomp->name; ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                            </div>
                            <table id="agentChannelCostPrice">
                                
                            </table>
                            <p><a href="#">默认显示5条，点击查看全部</a></p>
                        </div>
                        </form>    
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Incoice){?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz"><i></i>已选择渠道</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>渠道商选择：</dt>
                                <dd><?php echo $this->billall->agentcompname?$this->billall->agentcompname->name:""; ?></dd>
                            </dl>
                            <dl>
                                <dt>快递方式：</dt>
                                <dd><?php echo $this->billall->channelname ? $this->billall->channelname->name : ""; ?></dd>
                            </dl>
                        </div>
                    </td>
                </tr> 
            </table>
        </div>
        <?php }?>
        <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Incoice && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft"><p>待拣货</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming">请打印好清单、地址标签、发票等单据进行拣货！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" id="pick" class="anvbotton5"><span>设为已拣货</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_PickError && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft"><p>待拣货</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming buzc">[拣货异常] 以下物品暂时无法找到</p>
                            <table class="jhyc">
                                <tr>
                                        <th>物品编号</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                </tr>
                                <?php
                                    if ($this->storedetail != '') {
                                        foreach ($this->storedetail as $storeItem) {
                                            if($storeItem->status == Application_Model_WayItem::Status_Lose){
                                            $Item = $storeItem->StoreIdByItem;
                                            ?>
                                            <tr>
                                                <td><a class="ycwpbh" href="/admini/managestore/storedetail/id/<?php echo $Item->id;?>" target="_blank"><?php echo $Item->barcode;?></a></td>
                                                <td>无法找到</td>
                                                <td><a href="/admini/managewaybill/picking/id/<?php echo $this->billall->id;?>" class="anvbotton2"><span>已找到</span></a></td>
                                            </tr>
                                    <?php }   }    }  ?>
                            </table>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" id="pick" class="anvbotton5"><span>设为已拣货</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>  
        <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Picking && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz"><i></i>已拣货</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否正常：</dt>
                                <dd>正常</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Picking && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
        <div class="lcbox">
            <table class="lcks" >
                <form method="post" action="/admini/managewaybill/affirmpicking/id/<?php echo $this->billall->id; ?>" id="formshipment">
                    <tr>
                        <td class="lcleft"><p>待打包</p></td>
                        <td>
                            <div class="qudao">
                                <dl>
                                    <dt>渠道单号：</dt>
                                    <dd>
                                        <div class="textbox"><input class="textinput w250" type="text" id="agentNo" name="agentNo" /></div>
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>包裹重量：</dt>
                                    <dd>
                                        <div class="textbox"><input class="textinput" type="text" id="forecastWeight" name="forecastWeight"/></div><span>kg</span>
                                    </dd>
                                </dl>
                                    <dl>
                                    <dt>包裹尺寸：</dt>
                                    <dd>
                                        <div class="chicun">
                                            <input class="textinput w30" type="text" id="forecastlength" name="forecastlength" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                            <input class="textinput w30" type="text" id="forecastwidth" name="forecastwidth" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                            <input class="textinput w30" type="text" id="forecastheight" name="forecastheight" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><span>CM</span></div>
                                        <span class="tijizl"></span>
                                    </dd>
                                </dl>
                                <div class="lctijiao">
                                    <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                    <input type="hidden" id="operate" name="operate" value="singment" />
                                    <input type="hidden" id="forecastvolumeWeight" name="forecastvolumeWeight" value="0">
                                    <a href="javascript:void(0)" id="shipment" class="anvbotton5"><span>设为已打包</span></a>
                                </div>
                            </div>
                        </td>
                    </tr>
                </form>
                </table>
            </div>
            <?php }?>
            <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Pick  && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
            <?php 
                $ckweight = false;
                if($byweight == 1){
                    if($this->firstWeight){
                        $ckweight = ($this->firstWeight->weight/1000)>$payWeight?true:false;
                    }
                }else{
                    if($this->firstvolumeWeight){
                        $ckweight = ($this->firstvolumeWeight->weight/1000)>$payWeight?true:false;
                    }
                }
            ?>
            <div class="lcbox">
                <table class="lcwc">
                    <tr>
                        <td class="lcleft">
                            <p class="yixz"><i></i>已打包</p>
                        </td>
                        <td>
                            <div class="qudao">
                                    <dl>
                                    <dt>渠道单号：</dt>
                                    <dd><?php echo $this->billall->agentNo; if($this->billall->agentNo == $this->billall->logistics){?><em>[原单]</em><?php } ?></dd>
                                </dl>
                                    <dl>
                                    <dt>包裹重量：</dt>
                                    <dd><?php echo $this->firstWeight?$this->firstWeight->weight/1000:0; ?>kg</dd>
                                </dl>
                                    <dl>
                                    <dt>体积重量：</dt>
                                    <dd><?php $volumLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillVolume); 
                                        if($this->firstvolumeWeight){
                                            echo ($this->firstvolumeWeight&&$this->firstvolumeWeight->weight != 0)?($this->firstvolumeWeight->weight/1000)."kg":"";
                                            echo $volumLog?($volumLog->description != "**"?'<em>-</em>[尺寸:'.$volumLog->description."cm]":"无"):"无";
                                        } else {
                                            echo "无";
                                        }
                                        ?></dd>
                                </dl>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <?php }?>
            <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Pick && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
            <div class="lcbox">
                <table class="lcwc">
                    <tr>
                        <td class="lcleft"><p>待确认渠道</p></td>
                        <td>
                        <div class="qudao" id="indexqudao">
                            <p class="sming" <?php echo $ckweight?"style='color:#c00'":"";?>>请根据打完包的重量确认渠道选择是否合理！</p>
                            <div class="lctijiao">
                                <ul>
                                    <li><a href="javascript:void(0)" class="anvbotton5" id="affirmqudao"><span>已确认</span></a></li>
                                    <li><a href="javascript:void(0)" class="anvbotton6" id="editchannel"><span>修改渠道</span></a></li>
                                </ul>
                            </div>
                        </div>
                            <form style="display:none;" method="post" action="/admini/managewaybill/affirmeditchannel/id/<?php echo $this->billall->id; ?>" id="formshipchanner">
                        <div class="qudao">
                            
                                <dl>
                                    <dt>修改渠道商：</dt>
                                    <dd>
                                        <?php foreach ($this->agentcomp as $key => $agentcomp) { ?>
                                            <label><input name="agentid" class="agentid" type="radio" value="<?php echo $agentcomp->id; ?>" /><?php echo $agentcomp->name; ?></label>
                                        <?php } ?>
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>修改快递方式：</dt>
                                    <dd>
                                        <select name="channer" id="channer">    
                                        </select><label class="suoyou"><input name="radioChannel" id="radioChannel" type="checkbox" value="">所有</label>
                                    </dd>
                                </dl>
                                <div class="lctijiao">
                                    <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                    <a class="anvbotton5" href="javascript:void(0)" id="shipchanner"><span>确认</span></a>
                                    <a href="javascript:void(0)" style="margin-left:50px;" class="anvbotton6" id="cancelEdit"><span>取消修改</span></a>
                                </div>
                            
                        </div>
                        <div class="qudaojiage">
                                <div class="jglan">
                                <h3><?php echo ($this->getWeight?$this->getWeight:0)."kg - ".$this->billall->ExpressBy->name;?>各渠道价格对比</h3>
                                <div class="qitaqd">
                                    <label>其他方式：</label>
                                    <select name="editshiptype" id="editshiptype">
                                        <?php foreach ($this->allshiptype as $eccomp) { ?>
                                            <option value="<?php echo $eccomp->id; ?>" <?php echo $eccomp->id == $this->billall->expressId?"selected":""; ?>><?php echo $eccomp->name; ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                            </div>
                            <table id="agentChannelCostPrice">
                                
                            </table>
                            <p><a href="#">默认显示5条，点击查看全部</a></p>
                        </div>
                                </form>
                        </td>
                    </tr>
                </table>
            </div>
            <?php }?>
            <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_AffirmChannel && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
            <div class="lcbox">
                <table class="lcwc">
                    <tr>
                        <td class="lcleft">
                            <p class="yixz"><i></i>已确认渠道</p>
                        </td>
                        <td>
                            <?php 
                                $agentLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillAffirmAgent); 
                                $channelLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillAffirmChannel); 
                                if($agentLog && $channelLog){
                            ?>
                                <div class="qudao">
                                    <dl>
                                        <dt>渠道修改为：</dt>
                                        <dd><?php echo $agentLog->DescriptionByAgent->name;?></dd>
                                    </dl>
                                    <dl>
                                        <dt>快递修改为：</dt>
                                        <dd><?php echo $channelLog->DescriptionByChannel->name;?></dd>
                                    </dl>
                                </div>
                            <?php } else { ?>
                                <div class="qudao">
                                    <dl>
                                    	<dt>是否确认：</dt>
                                        <dd>已确认</dd>
                                    </dl>
                                </div>
                            <?php } ?>
                        </td>
                    </tr>
                </table>
            </div>
            <?php }?>
            <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_AffirmChannel && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
            <div class="lcbox">
                <table class="lcwc">
                    <tr>
                        <td class="lcleft"><p>待交运</p></td>
                            <td>
                            <div class="qudao">
                                <p class="sming">请打印并确认好交接单，等待渠道商取货！</p>
                                <div class="lctijiao"><a href="javascript:void(0)" class="anvbotton5" id="affirmjiao"><span>设为已交运</span></a></div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <?php }?>
            <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
            <div class="lcbox">
                <table class="lcwc">
                    <tr>
                        <td class="lcleft">
                            <p class="yixz"><i></i>已交运</p>
                        </td>
                        <td>
                            <div class="qudao">
                                <dl>
                                    <dt>是否交运：</dt>
                                    <dd>已交运</dd>
                                </dl>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <?php }?>
            
    </div>
<?php }?>

<?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage  && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
<div class="yunshu">
    <div class="lanmu">
        <h2>运输流程</h2>
    </div>
    
    <?php if(($this->billall->interior == Application_Model_wayBillItem::Interior_Outstorage || $this->billall->interior == Application_Model_wayBillItem::Interior_OverSystem) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
    <div class="lcbox">
        <table class="lcks" >
            <form method="post" action="/admini/managewaybill/affirmsystem/id/<?php echo $this->billall->id; ?>" id="formshipleno">
            <tr>
                <td class="lcleft"><p>待入系统</p></td>
                <td>
                    <div class="qudao">
                        <dl>
                            <dt>结算重量：</dt>
                            <dd>
                                <div class="textbox"><input class="textinput w250" type="text"  id="lastWeight" name="lastWeight" value="<?php echo $this->billall->lastWeight?$this->billall->lastWeight/1000:"";?>"/></div><span class="ksd">kg</span>
                            </dd>
                        </dl>
                        <dl>
                            <dt>包裹尺寸：</dt>
                            <dd>
                                <div class="chicun">
                                    <input class="textinput w30" type="text" id="length" name="length"  onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                    <input class="textinput w30" type="text" id="width" name="width"  onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                    <input class="textinput w30" type="text" id="height" name="height"  onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><span>CM</span></div>
                            </dd>
                        </dl>
                        <dl>
                            <dt>结算体积：</dt>
                            <dd>
                                <div class="textbox"><input class="textinput w250" type="text" id="lastVolumeWeight" name="lastVolumeWeight" value="<?php echo $this->billall->lastVolumeWeight?$this->billall->lastVolumeWeight/1000:"";?>" /></div>
                                <span class="ksd">kg</span><div class="jisuan"><a href="javascript:void(0)" id="ckmoney" class="anvbotton3">计算金额</a></div>
                            </dd>
                        </dl>
                        <dl>
                            <dt>结算金额：</dt>
                            <dd>
                                <ul>
                                    <li><div class="textbox"><input class="textinput w80" type="text" id="lastMoney" name="lastMoney"/></div><span class="ksd">元</span></li>
                                    <li><span class="jstuikuan">退款：</span><div class="textbox"><input class="textinput w80" type="text" name="refundMoney" id="refundMoney"/></div><span class="ksd">元</span></li>
                                </ul>
                            </dd>
                        </dl>
                        <div class="lctijiao">
                            <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                            <a href="javascript:void(0)" class="anvbotton5" id="shipleno"><span>设为已入系统</span></a>
                        </div>
                    </div>
                </td>
            </tr>
            </form>
        </table>
        <?php }?>
        <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_System && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError && $this->billall->interior != Application_Model_wayBillItem::Interior_OverSystem){?>
        <div class="lcbox">
            <table class="lcwc" >
                <tr>
                    <td class="lcleft">
                        <p class="yixz"><i></i>已入系统</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>结算重量：</dt>
                                <dd><?php echo $this->billall->lastWeight / 1000; ?>kg</dd>
                            </dl>
                            <dl>
                                <dt>结算体积：</dt>
                                <dd>
                                    <?php if($this->billall->lastVolumeWeight){
                                            echo ($this->billall->lastVolumeWeight != 0)?($this->billall->lastVolumeWeight/1000)."kg":"";
                                            echo $this->billall->lwhth != "**" ?($this->billall->lwhth != "" ? "<em>-</em>[尺寸:".$this->billall->lwhth . "cm]" : "无 " ): "无";
                                        } else {
                                            echo "无";
                                        }?>
                                </dd>
                            </dl>
                            <dl>
                                <dt>结算金额：</dt>
                                <dd>
                                    <ul>
                                        <li class="num">￥<?php echo $this->billall->lastMoney; ?></li>
                                        <li class="tk">[退款：￥<?php echo $this->billall->refundMoney; ?>]</li>
                                    </ul>
                                </dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if(($this->billall->interior == Application_Model_wayBillItem::Interior_System || $this->billall->interior == Application_Model_wayBillItem::Interior_Oversingleno) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
        <div class="lcbox">
            <table class="lcks" >
                <form method="post" action="/admini/managewaybill/affirmsingle/id/<?php echo $this->billall->id; ?>" id="formsystem">
                    <tr>
                        <td class="lcleft"><p>待出转单</p></td>
                        <td>
                            <div class="qudao">
                                <dl>
                                    <dt>填写转单号：</dt>
                                    <dd>
                                        <div class="textbox"><input class="textinput w250" type="text" id="logistics" name="logistics" value="<?php echo $this->billall->logistics;?>"/></div>
                                    </dd>
                                </dl>
                                <div class="lctijiao">
                                    <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                    <a href="javascript:void(0)" class="anvbotton5" id="billsingle"><span>提交确认</span></a>
                                </div>
                            </div>
                        </td>
                    </tr>
                </form>
            </table>
        </div>
        <?php }?>
        <?php if(($this->billall->interior >= Application_Model_wayBillItem::Interior_Singleno && $this->billall->interior < Application_Model_wayBillItem::Interior_PickError) || $this->billall->interior > Application_Model_wayBillItem::Interior_Oversingleno){?>
        <div class="lcbox">
            <table class="lcwc" >
                <tr>
                    <td class="lcleft">
                        <p class="yixz"><i></i>已出转单</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>转单号：</dt>
                                <dd><?php echo $this->billall->logistics;?></dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if(($this->billall->interior == Application_Model_wayBillItem::Interior_Singleno || $this->billall->interior == Application_Model_wayBillItem::Interior_OutTransportation) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
        <div class="lcbox">
            <table class="lcwc" >
                <tr>
                    <td class="lcleft"><p>待确认上网</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming">请及时进入渠道商系统跟踪是否上网！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id="affirmshang"><span>确认已上网</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if(($this->billall->interior >= Application_Model_wayBillItem::Interior_Transportation && $this->billall->interior < Application_Model_wayBillItem::Interior_PickError) || $this->billall->interior > Application_Model_wayBillItem::Interior_OutTransportation){?>
        <div class="lcbox">
            <table class="lcwc" >
                <tr>
                    <td class="lcleft">
                        <p class="yixz"><i></i>已上网</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否上网：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if(($this->billall->interior == Application_Model_wayBillItem::Interior_Transportation || $this->billall->interior == Application_Model_wayBillItem::Interior_Overachieve) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)){?>
        <div class="lcbox">
            <table class="lcwc" >
                <tr>
                    <td class="lcleft"><p>待确认签收</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming">确保运单被客户签收，本次服务才算圆满！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id="affirmqian"><span>确认已签收</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php }?>
        <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Achieve){?>
        <div class="lcbox">
            <table class="lcwc" >
                <tr>
                    <td class="lcleft">
                        <p class="yixz"><i></i>已签收</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否签收：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <?php } ?>
       
</div> 
<?php } ?>
<?php if($this->problemWay){
    if($this->problemWay->status == Application_Model_ProblemWay::Problem_ReturnCancel){
?>
<div class="yunshu">
    <div class="lanmu">
            <h2>退货流程</h2>
    </div>
    <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){ ?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_Default){ ?>
        <div class="lcbox">
            <form method="post" action="/admini/manageproblem/scheduledefault/id/<?php echo $this->billall->id; ?>" id="formdefault">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待申请</p></td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>退包类型：</dt>
                                <dd>
                                    <ul>
                                        <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="渠道商退包" checked>渠道商退包</label></li>
                                        <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="快递公司退包">快递公司退包</label></li>
                                        <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="外国海关退包">外国海关退包</label></li>
                                        <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="无人签收退包">无人签收退包</label></li>
                                    </ul>
                                </dd>
                            </dl>
                            <div class="lctijiao">
                                <a href="javascript:$('#formdefault').submit()" class="anvbotton5"><span>确认已申请</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
            </form>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ApplyFor){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                        <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已申请</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>退件类型：</dt>
                                <dd><?php echo $this->problemWay->ReasonBySchedule?$this->problemWay->ReasonBySchedule->content:"悠奇仓库退件";?></dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->ReasonBySchedule){ 
            if($this->problemWay->ReasonBySchedule->content != "渠道商退包") {
        ?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ApplyFor){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>确认退件</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming">请确认退件申请是否受理成功！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id="scheduleApplyFor"><span>已确认</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ReturnRoute){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>退件途中</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>受理状态：</dt>
                                <dd>已受理，退件途中</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ReturnRoute){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待回渠道商</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming">请及时跟进退件状态！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='ScheduleReturnRoute'><span>已回渠道商</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php } }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_InChannel){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已在渠道商</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>回渠道确认：</dt>
                                <dd>已退至<?php echo $agentLog?$agentLog->DescriptionByAgent->name:($this->billall->agentcompname?$this->billall->agentcompname->name:"悠奇仓库");?></dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InChannel){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待退回悠奇</p></td>
                        <td>
                        <div class="qudao">
                            <p class="sming">请确认退件是否已回悠奇！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='ScheduleInChannel'><span>确认已退回</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_InUuch){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已退回悠奇</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否已退回：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InUuch){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待入仓</p></td>
                    <td>
                        <div class="qudao">
                                <p class="sming">请将退件物品进行入仓处理！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='ScheduleInUuch'><span>确认已入仓</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InStore){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已入仓</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否已入仓：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
</div>
    <?php  }
    if($this->problemWay->status == Application_Model_ProblemWay::Problem_PartReturn){
?>
<div class="yunshu">
    <div class="lanmu">
            <h2>部分物品退回流程</h2>
    </div>
    <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){ ?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_Default){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待申请</p></td>
                    <td>
                        <div class="qudao">
                                <p class="sming">为确保包裹正常运送，请向渠道商申请退回部分物品！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='PartDefault'><span>确认已申请</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ApplyFor){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                        <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已申请</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否已申请：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ApplyFor){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>确认退回</p></td>
                    <td>
                        <div class="qudao">
                            <p class="sming">请确认退件申请是否受理成功！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='PartApplyFor'><span>已确认</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ReturnRoute){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>退回途中</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>受理状态：</dt>
                                <dd>已受理，退回途中</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ReturnRoute){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待退回悠奇</p></td>
                        <td>
                        <div class="qudao">
                            <p class="sming">请确认物品是否已退回悠奇！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='PartReturnRoute'><span>确认已退回</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php }?>
    <?php if($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_InUuch){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已退回悠奇</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否已退回：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InUuch){ ?>
        <div class="lcbox">
            <table class="lcks">
                <tr>
                    <td class="lcleft"><p>待入仓</p></td>
                    <td>
                        <div class="qudao">
                                <p class="sming">请将退回的物品进行入仓处理！</p>
                            <div class="lctijiao">
                                <a href="javascript:void(0)" class="anvbotton5" id='PartInUuch'><span>确认已入仓</span></a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InStore){ ?>
        <div class="lcbox">
            <table class="lcwc">
                <tr>
                    <td class="lcleft">
                        <p class="yixz yixz2"><i></i>已入仓</p>
                    </td>
                    <td>
                        <div class="qudao">
                            <dl>
                                <dt>是否已入仓：</dt>
                                <dd>是</dd>
                            </dl>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <?php }?>
</div>
<?php } } ?>
<?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
<div class="genzongbox">
    <div class="lanmu">
            <h2>物流跟踪</h2>
    </div>
    <div class="genzong">
            <div class="genzongtop">
            <div class="genzinly">
                    <ul>
                    <li>信息来源：<a href="<?php echo $this->affirmExpressItem->expressUrl;?>"><?php echo $this->affirmExpressItem->key;?>官网</a></li>
                    <li>悠奇运单号：<?php echo $this->billall->billNo;?></li>
                    <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Singleno && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError){?>
                    <li><?php echo $this->affirmExpressItem->key;?>改单号：<?php echo $this->billall->logistics;?></li>
                    <?php } ?>
                </ul>
            </div>
            <div class="tjjilu">
                <label>操作时间：</label><input class="textinput w140" type="text" value="<?php echo date('Y-m-d H:i:s'); ?>" id="opdate" name="opdate"  />
                <label>内容：</label><input class="textinput w400" type="text" id="opremark" name="opremark"/><a class="anvbotton5" href="javascript:void(0)" id="addlog"><span>确认</span></a>
            </div>
        </div>
        <div class="genzonginfo">
            <table>
                <?php if($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior < Application_Model_wayBillItem::Interior_Singleno){
                        if ($this->liclog) {
                        foreach ($this->liclog as $key => $kval) {
                            ?>
                            <tr <?php echo $key == 0 ? 'class="red"' : ""; ?> id="liclog<?php echo $kval->id; ?>">
                                <td class="gz"><?php echo date("Y-m-d H:i", strtotime($kval->opDate)); ?></td>
                                <td><?php echo $kval->opRemark; ?></td>
                                <td class="gzsc"><a href="javascript:void(0)" id="dellog" name="<?php echo $kval->id; ?>">删除</a></td>
                            </tr>
                <?php  } } }
                    if(($this->billall->interior >= Application_Model_wayBillItem::Interior_Singleno  && $this->billall->interior < Application_Model_wayBillItem::Interior_PickError) || $this->billall->interior > Application_Model_wayBillItem::Interior_Oversingleno){ 
                        if ($this->billall->channer == 22) {
                        $Odly = new Uuch_AuspostAPI();
                        $OdlyItem = $Odly->Query($this->billall->logistics);
                        $pd = true;
                        if ($OdlyItem) {
                            foreach ($OdlyItem as $key => $OdlyItemval) {
                                if ($OdlyItemval->dateTime != "No events found") {
                                    $pd = false;
                                    ?>
                                    <tr <?php echo $key == 0 ? 'class="red"' : ""; ?> id="liclog">
                                        <td class="gz"><?php echo $OdlyItemval->dateTime; ?></td>
                                        <td><?php echo $OdlyItemval->activity; ?></td>
                                        <td class="gzsc"></td>
                                    </tr>
                                <?php
                                }
                            }
                            if ($this->liclog) {
                                foreach ($this->liclog as $key => $kval) {
                                    ?>
                                    <tr <?php echo $pd ? $key == 0 ? 'class="red"' : ""  : ""; ?> id="liclog<?php echo $kval->id; ?>">
                                        <td class="gz"><?php echo date("Y-m-d H:i", strtotime($kval->opDate)); ?></td>
                                        <td><?php echo $kval->opRemark; ?></td>
                                        <td class="gzsc"><a href="javascript:void(0)" id="dellog" name="<?php echo $kval->id; ?>">删除</a></td>
                                    </tr>
                                <?php }  } }
                        }else if ($this->billall->channer == 21) {
                            $Xjb = new Uuch_SpeedPostAPI();
                            $XjbItem = $Xjb->query($this->billall->logistics);
                            $pd = true;
                            foreach ($XjbItem as $key => $XjbItemval) {
                                if ($XjbItemval->status != "-") {
                                    $pd = false;
                                    ?>
                                    <tr <?php echo $key == 0 ? 'class="red"' : ""; ?> id="liclog">
                                        <td class="gz"><?php echo $XjbItemval->dateTime; ?></td>
                                        <td><?php echo $XjbItemval->status; ?></td>
                                        <td class="gzsc"></td>
                                    </tr>
                                <?php  } }
                            if ($this->liclog) {
                                foreach ($this->liclog as $key => $kval) {
                                    ?>
                                    <tr <?php echo $pd ? $key == 0 ? 'class="red"' : ""  : ""; ?> id="liclog<?php echo $kval->id; ?>">
                                        <td class="gz"><?php echo date("Y-m-d H:i", strtotime($kval->opDate)); ?></td>
                                        <td><?php echo $kval->opRemark; ?></td>
                                        <td class="gzsc"><a href="javascript:void(0)" id="dellog" name="<?php echo $kval->id; ?>">删除</a></td>
                                    </tr>
                                <?php } }
                        } else { ?>
                            <?php  if ($this->liclog) {
                                foreach ($this->liclog as $key => $kval) {
                                    ?>
                                    <tr <?php echo $pd ? $key == 0 ? 'class="red"' : ""  : ""; ?> id="liclog<?php echo $kval->id; ?>">
                                        <td class="gz"><?php echo date("Y-m-d H:i", strtotime($kval->opDate)); ?></td>
                                        <td><?php echo $kval->opRemark; ?></td>
                                        <td class="gzsc"><a href="javascript:void(0)" id="dellog" name="<?php echo $kval->id; ?>">删除</a></td>
                                    </tr>
                                <?php } }?>
                            <tr>
                                <td class="gz" colspan="3" style="text-align: left;">
                                    <iframe name="kuaidi100" src="<?php echo $this->logisticslog; ?>" width="600" height="380" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
                                </td>
                            </tr>
                        <?php } ?>
                <?php }?>
            </table>
        </div>                    
    </div>
</div> 
<?php } ?>   
    <div class="qingdan">
        <div class="lanmu">
            <h2>物品清单</h2><?php $arrlocation = @explode(",",$this->billall->locationName);?>
            <p><label>所占库位：</label>
                <?php foreach($arrlocation as $key => $valname){ 
                    if($valname != ""){
                        echo $valname;
                        if($key < count($arrlocation)-2){
                            echo "<span>|</span>";
                        }
                    }
                }?>
            </p>
        </div>
        <div class="wupintable">
            <div class="biaotbody">
                <table>
                    <tr>
                        <th class="li8"><div class="lileft">物品编号</div></th>
                        <th class="li35"><div class="lileft">物品信息</div></th>
                        <th class="li9"><div class="lileft">快递公司</div></th>
                        <th class="li9"><div class="lileft">快递号</div></th>
                        <th class="li7"><div class="lileft">来源</div></th>
                        <th class="li8"><div class="lileft">物品净重(kg)</div></th>
                        <th class="li8"><div class="lileft">预估体积(kg)</div></th>
                        <th class="li8"><div class="lileft">所在库位</div></th>
                        <th class="li8"><div class="lileft">拣货状态</div></th>
                    </tr>
                </table>
            </div>
            <div class="table">
                <table>
                    <?php
                        if ($this->storedetail != '') {
                            foreach ($this->storedetail as $storeItem) {
                                $Item = $storeItem->StoreIdByItem;
                                ?>
                                <tr>
                                    <td class="li8">
                                        <div class="lileft bianhao">
                                            <p><a href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>"  target="_blank"><?php echo $Item->barcode; ?></a></p>
                                            <span><?php echo $Item->createdate; ?></span>
                                        </div>
                                    </td>
                                    <td class="li35">
                                        <div class="lileft wpinfo">
                                            <div class="spic">
                                                <a href="<?= $this->cdn ?><?= !is_int(strpos('big',$Item->imageFile))?('/big'.$Item->imageFile):($Item->imageFile) ?>"  target="_blank">
                                                    <img src="<?php echo $this->cdn; ?><?php echo $Item->image; ?>" /></a>
                                            </div>
                                            <div class="wpinfobox">
                                                <h2><a href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>"  target="_blank"><?php echo $Item->productName; ?></a></h2>
                                                <p>属性：<?php echo $Item->ItemTypeName; ?></p>
                                            </div>
                                        </div>
                                    </td>
                                        <?php
                                            $b= (strpos($Item->orderNo,"["));
                                            $c= (strpos($Item->orderNo,"]"));
                                            $arrorder = explode(']',$Item->orderNo);
                                            ?>
                                    <td class="li9">
                                        <div class="lileft"><?php echo substr($Item->orderNo,$b+1,$c-1); ?></div>
                                    </td>                                
                                    <td class="li9">
                                        <div class="lileft"><?php echo count($arrorder)>1?$arrorder[1]:'';?></div>
                                    </td>   
                                    <td class="li7">
                                        <div class="lileft"><?php echo $Item->intype; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->weight / 1000; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->volumeWeight / 1000; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->locationNo?$Item->locationNo:"无"; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->InteriorName."(内部)<br><span style='color:#c0c'>$Item->StatusName(前台)</span>"; ?></div>
                                    </td>                             
                                </tr>
                        <?php } }?>
                </table>
            </div>    
        </div>
    </div>
</div>     
</div>
<div class="tanchuang" style="display:none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="wayProblem">问题包裹</div>
        <div class="nui-msgbox-hd" id="uuchInterior" style="display:none;">悠奇内部备注</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
    	<div class="wt_nav">
            <ul>
            	<li class="wt_on"><a href="javascript:void(0)" id="problem">问题沟通</a></li>
            	<li ><a href="javascript:void(0)" id="dispose">处理与进度</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box" id="problemComm">
        <div class="wt_center">
            <?php 
                if($this->issuedetail){
                    foreach($this->issuedetail as $problemVal){ ?>
                    <div class="<?php echo $problemVal->issuetype == 1?"wt_uuch":"wt_kehu"; ?>">
                        <h2><?php echo $problemVal->issuetype == 1?"悠奇客服":'回复人：<a href="/admini/manageuser/userdetail/id/'.$this->billall->userId.'" target="_blank">'.$this->billall->user->nikename.'</a>'; ?>
                            <span><?php echo $problemVal->dateCreated;?></span></h2>
                        <p><?php echo htmlspecialchars($problemVal->content);?></p>
                    </div>
            <?php } } ?>
        </div>
        <form method="post" action="/admini/managewaybill/affirmproblem/id/<?php echo $this->billall->id; ?>" id="formproblem">
            <div class="wt_caozuo">
                <textarea name="content" cols="" rows="" id="content"></textarea><a class="wt_liuyan" href="javascript:$('#formproblem').submit();"><span>留言</span></a>
            </div>
        </form>
    </div>
    <div class="wenti_box" id="interiorRemark" style="display:none;">
        
        <form method="post" action="/admini/managewaybill/addinteriorremark/id/<?php echo $this->billall->id; ?>" id="formremark">
            <div class="wt_caozuo">
                <textarea name="interiorcontent" cols="" rows="" id="interiorcontent"><?php echo $arrInteriorRemark?$arrInteriorRemark[1]:"";?></textarea><a class="wt_liuyan" href="javascript:$('#formremark').submit();"><span>留言</span></a>
            </div>
        </form>
    </div>
    <div class="wenti_box2"  style="display:none;">
        <form method="post" action="/admini/managewaybill/affirmschedule/id/<?php echo $this->billall->id; ?>" id="formschedule">
            <div class="wttj">
                <input class="textinput w140" type="text" value="<?php echo date("Y-m-d H:i:s");?>" id='crdate' name='crdate'/>
                <input class="textinput w300" type="text" id='schedule' name='schedule' /><a class="anvbotton5" href="javascript:void(0)" id='affirmjindu'><span>确认</span></a>
            </div>
        </form>
	<div class="wenti_jindu">
            <table>
                <?php 
                if($this->scheduledetail){
                    foreach($this->scheduledetail as $key => $operateVal){ ?>
                    <tr <?php echo $key==0?'class="jd_on"':"";?>>
                        <td class="wtjd_z"><p><?php echo $operateVal->dateCreated;?><i></i></p></td>
                        <td><?php echo $operateVal->content;?></td>
                    </tr>
                <?php } }?>
            </table>
        </div>
        <div class="wenticaoz">
            <?php if($this->problemWay->status != ""){
                if($this->problemWay->status != Application_Model_ProblemWay::Problem_StayUser && $this->problemWay->status != Application_Model_ProblemWay::Problem_StayUuch ){ ?>
            <p>该问题运单已选择<?php echo $this->problemWay->StatusName;?>！<a href="javascript:void(0)" id='CancelReturn'>取消</a></p>
            <?php } else {?>
            <ul>
            	<li><a class="anvbotton6" id='ReturnCancel'><span>退件</span></a></li>
            	<li><a class="anvbotton6" id='PartReturn'><span>部分退回</span></a></li>
            	<li><a class="anvbotton6" id='achieveProblem'><span>设为正常</span></a></li>
            </ul>
            <?php } } ?>
        </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>
</div>
<script type="text/javascript">
    $(".jinerjt").live("mouseenter",function(){
        $(this).next("div").attr("style","");
    });
    $(".jinerxial").mouseleave(function(){
        $(".jinerxial .jinerxiang").attr("style","display:none;");
    });
    $("#editInterior").click(function(){
        $("#editupdete").attr("class","nui-btn nuion");
        $(this).next("div").attr("style","");
    });
    $("#editStatus").click(function(){
        $("#updeteedit").attr("class","nui-btn nuion");
        $(this).next("div").attr("style","");
    });
    $("#updeteedit").mouseleave(function(){
        $("#updeteedit").attr("class","nui-btn");
        $("#updeteedit .ztlist").attr("style","display:none;");
    });
    $("#editupdete").mouseleave(function(){
        $("#editupdete").attr("class","nui-btn");
        $("#editupdete .ztlist").attr("style","display:none;");
    });
    $(".dian").mouseenter(function(){
       $(this).next("div").attr("style","display:block;");
    });
    $(".bzloading").mouseleave(function(){
        $(".bzloading .bzxiangbox").attr("style","display:none;");
    });
    $("#cancel").live('click',function(){
        if(<?php echo $this->billall->problem?$this->billall->problem:0;?> == 1){
            if(<?php echo $this->billall->interior>Application_Model_wayBillItem::Interior_Picking?1:0;?>){
                alert("不能直接取消已经打包的运单，可以走问题运单处理的退件！");
                return false;
            }else{
                if(confirm("您确定取消该运单？","提示信息")){            
                    $.ajax({    
                        type: 'POST',
                        url: '/admini/managewaybill/cancel/id/<?php echo $this->billall->id;?>',
                        success: function(data) {
                            if(data == 2){
                                alert("运单取消成功！");
                            }else if(data == 22){
                                alert("只能撤销未受理和问题的运单");
                            }else{
                                alert("发生未知错误，请重新操作");
                            }
                            location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                        }
                    });
                }
            }
        }else{
            alert("只能取消问题运单！");
            return false;
        }
    });
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Processing){?>
        $('#hear').live("click",function(){
            var pv=parseFloat($('#premiumFee').text());
            var isContinue = true;
            if(!isNaN(pv) && pv>=5000){
                isContinue = confirm('请注意,投保价值大于5000元,请上报主管!是否继续受理');
            }
            if(!isContinue){
                return false;
            }
            $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/billhear/idlist/<?php echo $this->billall->id; ?>/payWeight/<?php echo $payWeight;?>',
                    success: function(data) {
                        if(data == 1){
                            alert("受理成功");
                        }else if(data == 0){
                            alert("运单的前台状态不是未受理！");
                        }else{
                            alert("发生未知错误，请重新操作");
                        }
                        location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id; ?>';
                    }
                });
            return false;
        });
    <?php }?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Confrimed){ ?>
        $("#radioChannel").click(function(){
            fillChannel($('.agentid:checked').val());
        });
        $("#editshiptype").live("change",function(){
            var id = $(this).val();
            $("#agentChannelCostPrice").html('<tr><td>正在获取报价,请稍候</td></tr>');
            $.post('/admini/managewaybill/trans', {'id':id,'word':"<?php echo $this->billall->state;?>",'rweight':"<?php echo $payWeight;?>"}, function(sj){
                     var html = "";
                     html = '<tr><th class="jg0">选择</th><th class="jg1">代理商</th><th class="jg2">发货渠道</th><th class="jg3">报价(元)</th></tr>';
                     if(sj.data){
                        $.each(sj.data, function(key, val) {
                           html+= '<tr><td><input type="radio" class="channel" value="'+ val.id +'" name="channel" /></td><td>'+val.agentName+'</td><td>'+val.channelName+'</td><td>'+val.price+'</td></tr>';
                        });
                     }
                    $("#agentChannelCostPrice").html(html);
                }, 'json');
        });
    <?php }?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Incoice || $this->billall->interior == Application_Model_wayBillItem::Interior_PickError){?>
        $('#pick').click(function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/managewaybill/affirmpick/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台运单状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
       });
       function affirmPicking(id)
       {
           if(confirm("您确定该商品已经找到吗？","提示信息")){ 
                $.ajax({    
                   type: 'POST',
                   url: '/admini/managewaybill/affirmfind/id/<?php echo $this->billall->id;?>/storeid/'+id,
                   success: function(data) {
                       if(data == 1){
                           alert("成功找到！");
                       }else if(data == 2){
                           alert("请检查运单是否存在");
                       } else if(data == 3){
                           alert("请检查丢失商品是否找到");
                       }else {
                           alert("发生未知错误，请重新操作");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
               });
            }
       }
    <?php }?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Picking){?>
        $('#forecastlength,#forecastwidth,#forecastheight').change(function(){
            var length = $('#forecastlength').val();
            var width = $('#forecastwidth').val();
            var height = $('#forecastheight').val();
            var vloume = length*width*height/5000;
            if(vloume > 0){
                var html = "[体积重量为 = "+vloume+"kg]";
                $(".tijizl").html(html);
                $('#forecastvolumeWeight').attr('value', vloume);  
            }else{
                $(".tijizl").html("");
                $('#forecastvolumeWeight').attr('value', "0"); 
            }
        });
        $("#shipment").click(function(){
           var agentNo = $("#agentNo").val();
           var forecastWeight = $("#forecastWeight").val();
           var forecastvolumeWeight = $("#forecastvolumeWeight").val();
           var arrW = forecastWeight.split(".");
           if(agentNo == ""){
               alert("渠道单号不能为空!");
           }else if($.trim($('#forecastWeight').val()) == ""){
                alert("物品重量不能为空");
                return false;
           }else if(arrW.length>2 ){
                if(!$.isNumeric(arrW[0]) || !$.isNumeric(arrW[1])){
                    alert("物品重量格式错误");
                    return false;
                }
           }else{
               <?php  if($byweight == 1){ ?>
                        if(forecastWeight > <?php echo $payWeight ?> ){
                            if(confirm("该运单的打包重量大于预付重量，您确认继续设置下去？","提示信息")){  
                                $('#formshipment').submit();
                            }
                        }else{
                            $('#formshipment').submit();
                        }
                <?php }else{ ?>
                        if(forecastvolumeWeight > <?php echo $payWeight ?> ){
                            if(confirm("该运单的打包重量大于预付重量，您确认继续设置下去？","提示信息")){  
                                $('#formshipment').submit();
                            }
                        }else{
                            $('#formshipment').submit();
                        }
                <?php   }  ?>
               
           }
        });
    <?php }?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Pick){?>
        $("#editchannel").click(function(){
            $("#indexqudao").hide();
            $("#formshipchanner").show();
        });
        $("#editshiptype").live("change",function(){
            var id = $(this).val();
            $("#agentChannelCostPrice").html('<tr><td>正在获取报价,请稍候</td></tr>');
            $.post('/admini/managewaybill/trans', {'id':id,'word':"<?php echo $this->billall->state;?>",'rweight':"<?php echo $payWeight;?>"}, function(sj){
                     var html = "";
                     html = '<tr><th class="jg0">选择</th><th class="jg1">渠道</th><th class="jg2">快递名称</th><th class="jg3">报价(元)</th></tr>';
                     if(sj.data){
                        $.each(sj.data, function(key, val) {
                           html+= '<tr><td><input type="radio" value="'+ val.id +'" name="channel" class="channel" /></td><td>'+val.agentName+'</td><td>'+val.channelName+'</td><td>'+val.price+'</td></tr>';
                        });
                     }
                    $("#agentChannelCostPrice").html(html);
                }, 'json');
        });
        $("#radioChannel").live("click",function(){
            fillChannel($('.agentid:checked').val());
        });
        $("#affirmqudao").click(function(){
            <?php if($ckweight){?>
                if(confirm("该运单的打包重量大于预付重量，您确认继续设置下去？","提示信息")){  
                    $.ajax({    
                       type: 'POST',
                       url: '/admini/managewaybill/affirmchannel/id/<?php echo $this->billall->id;?>',
                       success: function(data) {
                           if(data == 1){
                               alert("设置成功！");
                           }else{
                               alert("请检查前后台状态");
                           }
                           location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                       }
                    });
                }
            <?php } else { ?>
                $.ajax({    
                       type: 'POST',
                       url: '/admini/managewaybill/affirmchannel/id/<?php echo $this->billall->id;?>',
                       success: function(data) {
                           if(data == 1){
                               alert("设置成功！");
                           }else{
                               alert("请检查前后台状态");
                           }
                           location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                       }
                });
            <?php } ?>  
        });
        $("#shipchanner").click(function(){
            <?php if($ckweight){?>
                if(confirm("该运单的打包重量大于预付重量，您确认继续设置下去？","提示信息")){ 
                    $("#formshipchanner").submit();
                }
            <?php } else { ?>   
                $("#formshipchanner").submit();
            <?php } ?> 
        });
    <?php } ?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_AffirmChannel){?>
        $("#affirmjiao").click(function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/managewaybill/affirmout/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php } ?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Outstorage || $this->billall->interior == Application_Model_wayBillItem::Interior_OverSystem){?>
        $('#length,#width,#height').change(function(){
            var length = $('#length').val();
            var width = $('#width').val();
            var height = $('#height').val();
            var vloume = length*width*height/5000;
            if(vloume > 0){
                $('#lastVolumeWeight').attr('value', vloume);  
            }
        });
        $('#ckmoney').live("click",function(){
            var lastWeight = parseFloat($('#lastWeight').val());
            var volumeWeight = parseFloat($('#lastVolumeWeight').val());
            volumeWeight = isNaN(volumeWeight)?0:volumeWeight;
            var weight = lastWeight>volumeWeight?lastWeight:volumeWeight;
            var wayid = $('#billid').val();
            $.ajax({
                type: 'POST',
                url: '/admini/managewaybill/cultfee/weight/'+weight+'/wayId/'+wayid,
                success: function(data) {
                    if(data.refundMoney>0){
                        $('#lastMoney').attr("value",data.shipMoney);
                        $('#refundMoney').attr("value",data.refundMoney);
                    }else{
                        $('#lastMoney').attr("value",<?php echo $this->billall->shipMoney;?>);
                        $('#refundMoney').attr("value",0);
                    }
                }
              }); 
        });
        $("#shipleno").live("click",function(){
            var lastWeight = $('#lastWeight').val();
            var lastMoney = $('#lastMoney').val();
            var refundMoney = $('#refundMoney').val();
            if(lastWeight == ''){
                alert('实际重量不能为空！');
                return false;
            }else if(lastMoney == ''){
                alert('实际费用不能为空！');
                return false;
            }else if(refundMoney < 0 ){
                alert('用户预付款不足，不能发货！');
                return false;
            }else{
                if(refundMoney>0){
                     if(confirm("您确定是否要退款"+refundMoney+"元","提示信息")){  
                         $('#formshipleno').submit();
                     }
                }else{
                    $('#formshipleno').submit();
                }
            }
        });
    <?php } ?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_System || $this->billall->interior == Application_Model_wayBillItem::Interior_Oversingleno){?>
        $("#billsingle").live("click",function(){
            var logistics = $('#logistics').val();
            if(logistics == ""){
                alert('改单号不能为空！');
                return false;
            }else{
                $('#formsystem').submit();
            }
        });
    <?php } ?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Singleno || $this->billall->interior == Application_Model_wayBillItem::Interior_OutTransportation){?>
        $("#affirmshang").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/managewaybill/affirmtransportation/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 2){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php } ?>
    <?php if($this->billall->interior == Application_Model_wayBillItem::Interior_Transportation || $this->billall->interior == Application_Model_wayBillItem::Interior_Overachieve){?>
        $("#affirmqian").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/managewaybill/affirmachieve/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 2){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php } ?>
    <?php if($this->problemWay){ ?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_Default){ ?>
        $("#PartDefault").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/partdefault/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php } ?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ApplyFor){ ?>
        $("#scheduleApplyFor").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/scheduleapplyfor/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
        $("#PartApplyFor").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/partapplyfor/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ReturnRoute){ ?>
        $("#ScheduleReturnRoute").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/schedulereturnroute/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
        $("#PartReturnRoute").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/partreturnroute/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InChannel){ ?>
        $("#ScheduleInChannel").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/scheduleinchannel/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
     <?php }?>
    <?php if($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InUuch){ ?>
        $("#ScheduleInUuch").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/scheduleinuuch/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
        $("#PartInUuch").live("click",function(){
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/partinuuch/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        });
    <?php } ?>
    <?php } ?>
    $("#CancelReturn").live("click",function(){
        if(confirm("您确认取消对该问题运单的操作吗？","提示信息")){   
            $.ajax({    
                   type: 'POST',
                   url: '/admini/manageproblem/cancelreturn/id/<?php echo $this->billall->id;?>',
                   success: function(data) {
                       if(data == 1){
                           alert("设置成功！");
                       }else if (data == 2){
                           alert("该运单已经退款了，不能取消该问题运单的操作！");
                       }else{
                           alert("请检查前后台状态");
                       }
                       location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                   }
            });
        }
    });
    function editInterior(interior,name)
    {
        if(interior < <?php echo $this->billall->interior?$this->billall->interior:0;?>){    
            if(confirm("您确定把该运单的后台状态改为"+name+"？","提示信息")){   
               $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/editbillinterior/id/<?php echo $this->billall->id;?>/interior/'+interior,
                    success: function(data) {
                        if(data == 2){
                            alert("修改成功");
                        }else{
                            alert("出现未知错误");
                        }
                        location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id?>';
                    }
                });
            }
       }else{
            alert("不能把运单状态修改于现运单的状态之下，请重新选择！");
       }
    }
    function editStatus(status,name)
    { 
        if(confirm("您确定把该运单的前台状态改为"+name+"？","提示信息")){   
           if(status == "<?php echo Application_Model_wayBillItem::STATUS_ExpressBack;?>"){
               $("#issue").click();
           }else if(status == "<?php echo Application_Model_wayBillItem::STATUS_Cancel;?>"){
               $("#cancel").click();
           }else{
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/editbillstatus/id/<?php echo $this->billall->id;?>/status/'+status,
                    success: function(data) {
                        if(data == 2){
                            alert("修改成功");
                        }else{
                            alert("出现未知错误");
                        }
                        location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id?>';
                    }
                });
           }
       }
    }
    $("#addlog").live("click",function(){
       var opdate = $("#opdate").val();
       var opremark = $("#opremark").val();
       if(opdate == ''){
           alert("物流时间不能为空");
       }else if(opremark == ''){
           alert("物流信息不能为空");
       }else{
          $.post('/admini/managewaybill/addlogistics', {'wayid':<?php echo $this->billall->id?$this->billall->id:"";?>,'opdate':opdate,'opremark':opremark}, function(data){
                location.href = "/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>";
            }, 'json');
       }
    });
    $("#dellog").live("click",function(){
       var licid = $(this).attr("name");
       if(confirm("您确定删除该物流信息？","提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/managewaybill/dellogistics/id/'+licid,
                 success: function(data) {
                     $("tr#liclog"+licid).remove();
                 }
               });
       }
    });
    
    $("#issue").live("click",function(){
        $("div.houtai_overlay").attr("style","display:block;");
        $("div.tanchuang").attr("style","display:block;");
        $("#problem").click();
    });
    $(".nui-msgbox-close").live("click",function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $("div.tanchuang").attr("style","display:none;");
    });
    $("#problem").live("click",function(){
        $(".wt_top").attr("style","display:block");
        $(".wt_nav ul li").attr("class","");
        $(this).parents("li").attr("class","wt_on");
        $(".wenti_box2").attr("style","display:none");
        $("#interiorRemark").attr("style","display:none");
        $("#problemComm").attr("style","display:block");
        $("#wayProblem").attr("style","display:block");
    });
    $("#dispose").live("click",function(){
        $(".wt_top").attr("style","display:block");
        $(".wt_nav ul li").attr("class","");
        $(this).parents("li").attr("class","wt_on");
        $(".wenti_box").attr("style","display:none");
        $(".wenti_box2").attr("style","display:block");
        $("#wayProblem").attr("style","display:block");
    });
    $("#remarkUuch").live("click",function(){
        $("div.houtai_overlay").attr("style","display:block;");
        $("div.tanchuang").attr("style","display:block;");
        $(".wt_top").attr("style","display:none");
        $("#wayProblem").attr("style","display:none");
        $("#problemComm").attr("style","display:none");
        $(".wenti_box2").attr("style","display:none");
        $("#uuchInterior").attr("style","display:block");
        $("#interiorRemark").attr("style","display:block");
    });
    $("#affirmjindu").click(function(){
        var schedule = $("#schedule").val();
        if(schedule == ""){
            alert("进度内容不能为空");
            return false;
        }else{
            $("#formschedule").submit();
        }
    });
    $("#ReturnCancel").live("click",function(){
        if(confirm("您确定该问题运单已和客户协商好了？确认该运单退件？","提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/managewaybill/affirmreturncancel/id/'+<?php echo $this->billall->id;?>,
                 success: function(data) {
                        if(data == 1){
                            alert("设置成功！");
                        }else{
                            alert("出现未知错误！");
                        }
                        location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                    }
               });
       }
    });
    $("#PartReturn").live("click",function(){
        if(confirm("您确定该问题运单已和客户协商好了？确认该运单退回那些不符合规范的物品？","提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/managewaybill/affirmpartreturn/id/'+<?php echo $this->billall->id;?>,
                 success: function(data) {
                        if(data == 1){
                            alert("设置成功！");
                        }else{
                            alert("出现未知错误！");
                        }
                        location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                    }
               });
       }
    });
    $("#achieveProblem").live("click",function(){
        if(confirm("您确定该问题运单已和客户协商好了？决定放行？","提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/managewaybill/affirmachieveproblem/id/'+<?php echo $this->billall->id;?>,
                 success: function(data) {
                        if(data == 1){
                            alert("设置成功！");
                        }else{
                            alert("该运单未付款、已取消或者已完成！");
                        }
                        location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>';
                    }
               });
       }
    });
    $("#editwaybill").live("click",function(){
        $.ajax({
                type: 'POST',
                url: '/admini/managewaybill/editwaybill/id/<?php echo $this->billall->id;?>',
                success: function(data) {
                    if(data == 1){
                        alert("标记成功");
                    }else{
                        alert("发生未知错误，请重新操作");
                    }
                    location.href='/admini/managewaybill/billaccep/id/<?php echo $this->billall->id?>';
                }
            });
        return false;
    });
    
    $(function () {
            $.fn.numeral = function () {
                    $(this).css("ime-mode", "disabled");
                    this.bind("keypress", function (e) {
                        var code = (e.keyCode ? e.keyCode : e.which);  //兼容火狐 IE   
                        if (!$.browser.msie && (e.keyCode == 0x8))  //火狐下 不能使用退格键  
                        {
                            return;
                        }
                        return code >= 48 && code <= 57 || code == 46;
                    });
                    this.bind("blur", function () {
                        if (this.value.lastIndexOf(".") == (this.value.length - 1)) {
                            this.value = this.value.substr(0, this.value.length - 1);
                        } else if (isNaN(this.value)) {
                            this.value = " ";
                        } 
                    });
                    this.bind("paste", function () {
                        var s = clipboardData.getData('text');
                        if (!/\D/.test(s));
                        value = s.replace(/^0*/, '');
                        return false;
                    });
                    this.bind("dragenter", function () {
                        return false;
                    });
                    this.bind("keyup", function () {
                        this.value = this.value.replace(/[^\d.]/g, "");
                        //必须保证第一个为数字而不是.
                        this.value = this.value.replace(/^\./g, "");
                        //保证只有出现一个.而没有多个.
                        this.value = this.value.replace(/\.{2,}/g, ".");
                        //保证.只出现一次，而不能出现两次以上
                        this.value = this.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
                    });
                };
            $("#forecastWeight").numeral();
            $("#lastWeight").numeral();
            $("#lastVolumeWeight").numeral();
        });
   var channel = <?= json_encode($this->channel); ?>;
   function findChannel(agentId,expressId){
       var result = [];
       $.each(channel,function(index,item){
           if(item.agentId == agentId && (expressId == null || item.expressId == expressId)){
               result.push(item);
           }
       });
       return result;
   }
   function convertSelect(channel){
       var html='';
       $.each(channel,function(index,item){
           html += '<option value="'+ item.id +'">'+ item.name +'</option>';
       });
       return html;
   }
   function fillChannel(agentId){
       var channels = findChannel(agentId, $('#radioChannel').is(':checked')?null:$('#expressId').val());
           var html = convertSelect(channels);
           $('#channer').html(html);
   }
   $(function(){
       $('.agentid').click(function(){
          fillChannel($(this).val()) ;
       });
       //初始化时加载各代理商与渠道,价格信息
       $('.agentid').eq(0).click();
       $('#editshiptype').change();
   });
   $('#formshipchanner').submit(function(){
       if($('.channel:checked').length > 0){
           var price = parseFloat($('.channel:checked').parent().parent().children().last().text());
           var shipMoney =parseFloat($('#shipMoney').text().replace('元',''));
           if(price*1.3 > shipMoney){
               alert('注意,本订单利润不够,请登记一下,并上报给主管!');
           }
       }
       if(($('#channer').val() == '' || $('#channer').val()==null) && $('.channel:checked').length == 0){
           alert('请选择发货渠道');
           return false;
       }
   });
   $('#cancelEdit').click(function(){
       $('#formshipchanner').hide();
       $('#indexqudao').show();
   });
</script>
<?= $this->formHidden('expressId',$this->billall->ExpressId) ?>
<style>
    .qudao dl{clear: both;}
</style>